package com.fieldchain.ex.fa100.custom.dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.fieldchain.ex.fa100.R;
import com.fieldchain.ex.fa100.inter.SimpleCallBack;

/**
 * Created by 123 on 2018/5/30.
 */

public class PromptDialog extends BaseDialog {
    private TextView tvContent;
    private TextView tvDis;
    private TextView tvSure;

    private SimpleCallBack listener;

    public PromptDialog(Context context) {
        super(context);
    }

    @Override
    public int setLayout() {
        return R.layout.dialog_prompt;
    }

    @Override
    public void findView() {
        tvContent = (TextView) findViewById(R.id.tv_content);
        tvDis = (TextView) findViewById(R.id.tv_dis);
        tvSure = (TextView) findViewById(R.id.tv_sure);
    }
    public void setListener(SimpleCallBack listener) {
        this.listener = listener;
    }

    public void setContent(String content) {
        tvContent.setText(content);
    }

    public void setLeft(String content){
        tvDis.setText(content);
    }
    public void setRight(String content){
        tvSure.setText(content);
    }

    @Override
    public void setValue() {
        tvDis.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
            }
        });

        tvSure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
                if (listener != null) {
                    listener.sure();
                }
            }
        });

    }
}
